package com.lc.learn.fileana.controller;

import com.lc.learn.fileana.common.res.ApiResult;
import com.lc.learn.fileana.service.DocxToImgService;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @description: some desc
 * @author: LChuang
 * @date: 2023/10/30 15:20
 */
@RestController
@RequestMapping("/wps")
public class WpsController {

    @Resource
    private DocxToImgService docxToImgService;

    /**
     * 文档类型文件上传+解析
     */
    @PostMapping("/uploadAndAnalyze")
    public ApiResult uploadAndAnalyze(@RequestParam("file") MultipartFile file){
        return ApiResult.success();
    }



    @PostMapping("/docxToImg")
    public ApiResult docxToImg(){
        Map<String, String> map = new HashMap<>();
        String fileName = docxToImgService.fillContractContent(map);
        MultipartFile multipartFile = docxToImgService.wordToImg(fileName);
        // TODO 调用OSS实现图片存储
        return ApiResult.success();
    }

}
